package com.naiterui.ehp.bs.agent.vo;

import com.naiterui.ehp.bs.agent.entity.AgAgent;
import com.naiterui.ehp.bs.agent.util.ImgPathUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author yiren
 * @since 2022/2/15
 */
@Data
public class AgentItemVO {
	@ApiModelProperty(value = "经纪人ID")
	private Long agentId;

	@ApiModelProperty(value = "经纪人名称")
	private String agentName;

	@ApiModelProperty(value = "头像")
	private String headUrl;

	@ApiModelProperty(value = "经纪人职位")
	private String agentTitle;

	@ApiModelProperty(value = "经纪人手机号")
	private String agentPhone;

	@ApiModelProperty(value = "客户数量")
	private Integer customTotal;

	public static AgentItemVO of (AgAgent agent, String title, Integer customTotal) {
		AgentItemVO itemVO = new AgentItemVO();
		itemVO.setAgentId(agent.getId());
		itemVO.setAgentName(agent.getName());
		itemVO.setAgentPhone(agent.getPhone());
		itemVO.setHeadUrl(ImgPathUtil.pathToUrl(agent.getHeadUrl()));
		itemVO.setAgentTitle(title);
		itemVO.setCustomTotal(customTotal == null ? 0 : customTotal);
		return itemVO;
	}
}
